<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title>@title@ | GNUCITIZEN</title>
		<style>
			@import url(http://www.gnucitizen.org/styles/screen.base.css);

			div#header h1 a {
			width: 376px;
			height: 70px;
			display: block;
			background: url(http://www.gnucitizen.org/images/logo-w.png) no-repeat;
			}

			div#header h1 a span {
			display: none;
			}

			body#main {
			margin-left: 20%;
			margin-right: 20%;
			text-align: center;
			}

			body#main #header h1 a {
			margin-left: auto;
			margin-right: auto;
			}

			body#main #content {
			text-align: left;
			padding-left: 10px;
			padding-right: 10px;
			}

			h3 {
			font-size: 200%;
			margin-bottom: 0.2em;
			}

			.items {
			margin: 0;
			padding: 0;
			width: 100%;
			list-style-type: none;
			}

			.field-name {
			}

			.field-short {
			margin-top: 0.5em;
			font-style: italic;
			}

			.field-desc {
			margin-top: 0.5em;
			}

			.field-return-type {
			color: #333333; 
			border-bottom: 1px dotted;
			}

			.field-return-desc {
			}

			.field-param-name {
			color: #666666; 
			border-bottom: 1px dotted;
			}

			.field-param-type {
			color: #333333; 
			border-bottom: 1px dotted;
			}
		</style>
		<script src="http://www.gnucitizen.org/scripts/jquery.core.js" type="text/javascript"></script>
		<script>
			$(document).ready(function () {
				$.ajax({
					method: 'GET',
					url: 'dat/doc.json',

					success: function (data) {
						eval("window.data = " + data + ";");

						var cats = {};
						var last_cat = '';

						for (var i = 0; i < window.data.length; i++) {
							var item = window.data[i];

							if (last_cat != item.cat && !cats[item.cat]) {
								$('<div id="cat_' + item.cat + '" class="cat"><h3>' + item.cat + '</h3><ul class="items"></ul></div>').appendTo('#content').hide();
							}

							var params = [];

							for (var z = 0; z < item.params.length; z++) {
								var param = item.params[z];

								params.push('<span class="field-param-type">' + param.type + '</span> <span class="field-param-name">' + param.name + '</span>');
							}

							var params = params.join(', ');

							var returns = '';

							if (item.return) {
								returns = ' returns <span class="field-return-type">' + item.return.type + '</span> <span class="field-return-desc">' + item.return.desc + '</span>';
							}

							var markup = '';

							markup += '<li class="item">';
							markup += '<a href="#" class="field-name">' + item.name + '</a> ( ' + params + ' )' + returns + '<p class="field-short">' + item.short + '</p><p class="field-desc">' + item.desc + '</p>';
							markup += '<div class="item-content">';

							for (var z = 0; z < item.examples.length; z++) {
								var example = item.examples[z]
									.replace(/&lt;/g, '<')
									.replace(/&gt;/g, '>')
									.replace(/&amp;/g, '&');

								markup += '<h4>Example</h4><div class="field-example">' + example + '</div>';
							}

							markup += '</div>';
							markup += '</li>';

							var markup_item = $(markup).appendTo('#cat_' + item.cat + ' .items');

							markup_item.children('.field-desc').hide();
							markup_item.children('.item-content').hide();
							markup_item.children('a').toggle(
								function () {
									$(this).parent().children('.field-desc').show();
									$(this).parent().children('.field-short').hide();
									$(this).parent().children('.item-content').show();

									$(this).parent().css({'margin-bottom': '2.0em'});

									return false;
								},
								function () {
									$(this).parent().children('.field-desc').hide();
									$(this).parent().children('.field-short').show();
									$(this).parent().children('.item-content').hide();

									$(this).parent().css({'margin-bottom': ''});

									return false;
								}
							);

							cats[item.cat] = true;
							last_cat = item.cat;
						}

						$('.cat:first-child').show();

						// what a bug!!?!
						$('#navigation').hide();

						for (var cat in cats) {
							$('<li><a href="#cat_' + cat + '">category:<strong>' + cat + '</strong></a></li>').appendTo('#navigation ul').children('a').click(function () {
								$('.cat:visible').hide();
								$($(this).attr('href')).show();

								return false;
							});
						}

						// what a bug!!?!
						setTimeout(function () {
							$('#navigation').show();
						}, 1);
					}
				});
			});
		</script>
	</head>
	<body id="main">
		<div id="header">
			<h1><a href="javascript:document.location=document.location"><span>GNUCITIZEN</span></a></h1>
			<p><span>@caption@</span></p>
		</div>

		<div id="navigation">
			<h2>navigation</h2>
			<ul>
				<li><a href="@home@">link:<strong>Project</strong></a></li>
			</ul>
		</div>
		
		<div id="content" class="clearfix"></div>
		
		<div id="footer">
			<p>(<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.5/">CC</a>)2007 <a href="http://www.gnucitizen.org">GNUCITIZEN</a></p>
		</div>
		
		<!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">	
			<Work rdf:about="">
				<license rdf:resource="http://creativecommons.org/licenses/by-nc-nd/2.5/" />
				<dc:title>GNUCITIZEN</dc:title>
				<dc:date>2007</dc:date>
				<dc:creator><Agent><dc:title>Petko D. Petkov</dc:title></Agent></dc:creator>
				<dc:rights><Agent><dc:title>Petko D. Petkov</dc:title></Agent></dc:rights>
				<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text"/>
				<dc:source rdf:resource="http://www.gnucitizen.org"/>
			</Work>
			<License rdf:about="http://creativecommons.org/licenses/by-nc-nd/2.5/">
				<permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
				<permits rdf:resource="http://web.resource.org/cc/Distribution"/>
				<requires rdf:resource="http://web.resource.org/cc/Notice"/>
				<requires rdf:resource="http://web.resource.org/cc/Attribution"/>
				<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse"/>
			</License>
		</rdf:RDF> -->
		
		<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
		<script type="text/javascript">_uacct = "UA-363996-1"; urchinTracker();</script>
	</body>
</html>
